<template>
	<view>
		<!-- 预约二维码 - 通过 -->
		<weapp-qrcode v-if="itemData.state=='0'" :text="Text" :title="title"></weapp-qrcode>
		<!-- 预约详情 -->
		<BookingCarDetail v-if="itemData.cartype!=='2'" :item="itemData"></BookingCarDetail>
		<BookingPersonDetail v-else :item="itemData"></BookingPersonDetail>
		<!-- 审批情况 -->
		<ApproveView :item="itemData"></ApproveView>
	</view>
</template>

<script>
	import {
		Platform,Storage_Key
	} from '@/static/config.js';
	import BookingCarDetail from "@/pages/booking/components/booking-car/booking-car-detail.vue"
	import BookingPersonDetail from "@/pages/booking/components/booking-car/booking-person-detail.vue"
	import ApproveView from "@/pages/approve/components/booking/approve-view.vue"
import moment from 'moment/moment';
	export default {
		components: {
			BookingCarDetail,
			BookingPersonDetail,
			ApproveView,
		},
		data() {
			return {
				itemData: {},
				title: '我的预约码',
				Text: "",
				webUserInfo:'',
			}
		},
		onLoad(options) {
			if (options && options.item) {
				this.webUserInfo = this.$storage.get(Storage_Key.web_user_info, true);
				let usertype = !!this.webUserInfo?'':'youke';
				
				this.itemData = JSON.parse(decodeURIComponent(options.item));
				
				this.Text = Platform.tag + ',' + this.itemData.id + "," + this.itemData.carcode + "," + this.itemData
					.color + ',' + this.itemData.driver + ',' + usertype; 
				this.title = this.itemData.createtime?moment(this.itemData.createtime).format("YYYY-MM-DD HH:mm"):this.itemData.createtime.toString();

				// }
			}
		},
		methods: {
		
		}
	}
</script>

<style>

</style>
